#!/usr/bin/env python
#coding=utf-8 


# 异常的架构
# ├── BaseException
# │   ├── Exception
# │   ├── keyboardInterrupt
# │   └── systemExit

# 如果试图打开一个文件，如果一切正常无论在这一段代码的开支中间还是结束时发生异常，会执行清理的代码，此外文件任会被自动关闭
with open('/etc/passwd', 'r') as f:
	for eachLine in f:
		print eachLine,

# rasie 上升异常


# assert
# assert 1 == 0, 'one does not equal zero silly!'
try:
	assert 1== 0, 'one does not equal zero silly!'
except AssertionError, args:
	print '%s: %s' % (args.__class__.__name__, args)

# 可以通过sys模块 sys.exc_info()  来得到一个错误 



